package com.enation.app.javashop.core.client.fallback.goods;

import com.enation.app.javashop.core.client.feignimpl.goods.GoodsWordsClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.goodssearch.enums.GoodsWordsType;
import org.springframework.stereotype.Component;

/**
 * 商品分词熔断 fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:18
 **/
@Component
public class GoodsWordsClientFallbackFactory  extends BaseFallbackFactory<GoodsWordsClientFeignImpl> {
    @Override
    protected GoodsWordsClientFeignImpl fallback() {
        return new GoodsWordsClientFallback();
    }

    /**
     * 商品分词熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:15
     * @since v7.0
     */
    @Component
    public static class GoodsWordsClientFallback implements GoodsWordsClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public void delete(String words) {
            logger.error("删除分词错误");
        }

        @Override
        public void addWords(String words) {
            logger.error("添加分词错误");
        }

        @Override
        public void delete(GoodsWordsType goodsWordsType, Long id) {
            logger.error("删除分词错误");
        }

        @Override
        public void updateGoodsNum(String words) {
            logger.error("更新某个分词数量出错");
        }

        @Override
        public void batchUpdateGoodsNum() {
            logger.error("批量更新商品数量出错");
        }

    }
}
